﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using SimpleWeather.DataControllers;
using StyleMVVM.DependencyInjection;
using StyleMVVM.ViewModel;

namespace SimpleWeather.ViewModels
{
	public class ConfigurationViewModel : BaseViewModel
	{
		[Import]
		public IWeatherServiceController DataController { get; set; }

		public bool IsLocalEnabled
		{
			get
			{
				if (!DataController.IsLocalEnabled.HasValue)
				{
					return true;
				}

				return DataController.IsLocalEnabled.Value;
			}
			set
			{
				if (!DataController.IsLocalEnabled.HasValue || DataController.IsLocalEnabled.Value != value)
				{
					DataController.IsLocalEnabled = value;

					OnPropertyChanged();
				}
			}
		}

		public bool IsBostonEnabled
		{
			get
			{
				if (!DataController.IsBostonEnabled.HasValue)
				{
					return true;
				}

				return DataController.IsBostonEnabled.Value;
			}
			set
			{
				if (!DataController.IsBostonEnabled.HasValue || DataController.IsBostonEnabled.Value != value)
				{
					DataController.IsBostonEnabled = value;

					OnPropertyChanged();
				}
			}
		}
	}
}
